Adds a key/value pair to the
IDictionary if the key does not already exist.
Syntax
Parameters
- key
- The key of the element to add.
- value
- The value to be added, if the key does not already exist.
Exceptions
Example
Library/Library.Test/TestBTreeDictionary.cs
C# | Copy Code |
---|
BTreeDictionary<int, string> data = new BTreeDictionary<int, string>(Comparer);
Assert.AreEqual("a", data.GetOrAdd(1, "a"));
Assert.AreEqual("a", data.GetOrAdd(1, "b")); |
VB.NET | Copy Code |
---|
Dim data As New BTreeDictionary(Of Integer, String)(Comparer)
Assert.AreEqual("a", data.GetOrAdd(1, "a"))
Assert.AreEqual("a", data.GetOrAdd(1, "b")) |
Requirements
Target Platforms: Windows XP, Windows Server 2003, Windows Vista, Windows Server 2008, Windows 7
See Also